<template>
  <!-- <el-dialog
    :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'"
    :close-on-click-modal="false"
    :visible.sync="visible"
    class="JADP-dialog JADP-dialog_center"
    lock-scroll
    width="75%"
    v-loading="loading"
    @close="onClose"
  > -->
  <transition name="el-zoom-in-center">
    <div class="JADP-preview-main">
      <div class="JADP-common-page-header">
        <el-page-header
          @back="goBack"
          :content="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'"
        >
        </el-page-header>
        <div class="options">
          <el-button
            type="primary"
            @click="dataFormSubmit()"
            v-if="!isDetail"
            :loading="btnLoading"
            >确 定</el-button
          >
          <el-button @click="goBack">取 消</el-button>
        </div>
      </div>
      <el-row :gutter="15" class="main">
        <el-form
          ref="elForm"
          :model="dataForm"
          :rules="rules"
          size="small"
          label-width="150px"
          label-position="right"
          :disabled="!!isDetail"
        >
          <el-tabs v-model="activeName">
            <el-tab-pane label="基本信息" name="first">
              <el-col :span="24">
                <el-form-item
                  label="班级编号"
                  prop="clazzno"
                  label-width="120px"
                >
                  <el-input
                    v-model="dataForm.clazzno"
                    placeholder="请输入"
                    clearable
                    :style="{ width: '100%' }"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item
                  label="班级名称"
                  prop="classname"
                  label-width="120px"
                >
                  <el-input
                    v-model="dataForm.classname"
                    placeholder="请输入"
                    clearable
                    :style="{ width: '100%' }"
                  >
                  </el-input>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  label="行业类型"
                  prop="categorytype"
                  label-width="120px"
                >
                  <el-select
                    v-model="dataForm.categorytype"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    :multiple="false"
                  >
                    <el-option
                      v-for="(item, index) in getDict('hangye')"
                      :key="index"
                      :label="item.dataName"
                      :value="item.id"
                      :disabled="item.disabled"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  label="培训类别"
                  prop="train_type"
                  label-width="120px"
                >
                  <el-select
                    v-model="dataForm.train_type"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    :multiple="false"
                  >
                    <el-option
                      v-for="(item, index) in getDict('pxlb')"
                      :key="index"
                      :label="item.dataName"
                      :value="item.id"
                      :disabled="item.disabled"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <!-- <el-col :span="24">
          <el-form-item label="培训分类" prop="trainway" label-width="120px">
            <el-select
              v-model="dataForm.trainway"
              placeholder="请选择"
              clearable
              :style="{ width: '100%' }"
              :multiple="false"
            >
              <el-option
                v-for="(item, index) in getDict('trainway')"
                :key="index"
                :label="item.dataName"
                :value="item.id"
                :disabled="item.disabled"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col> -->
              <el-col :span="12">
                <el-form-item
                  label="是否需要审核"
                  prop="wheExamine"
                  label-width="120px"
                >
                  <el-select
                    v-model="dataForm.wheExamine"
                    placeholder="请选择"
                    :style="{ width: '100%' }"
                  >
                    <el-option label="否" value="0"></el-option>
                    <el-option label="是" value="1"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="是否需要评价"
                  prop="wheEvaluate"
                  label-width="120px"
                >
                  <el-select
                    v-model="dataForm.wheEvaluate"
                    placeholder="请选择"
                    :style="{ width: '100%' }"
                  >
                    <el-option label="否" value="0"></el-option>
                    <el-option label="是" value="1"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  v-if="dataForm.wheEvaluate == '1'"
                  label="评价选项"
                  prop="pjManageList"
                  label-width="120px"
                >
                  <el-input
                    class="teacher"
                    v-model="dataForm.pjManageName"
                    placeholder="请输入"
                    readonly
                    @click.native="acquisitionEvaluation"
                    :style="{ width: '100%' }"
                  >
                    <template slot="append">
                      <el-button
                        type="primary"
                        @click.stop="acquisitionEvaluation"
                        >选择班级评价</el-button
                      ></template
                    >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item
                  label="班主任"
                  prop="headteacher"
                  label-width="120px"
                >
                  <el-input
                    class="teacher"
                    v-model="dataForm.headteacher"
                    placeholder="请输入"
                    readonly
                    @click.native="teacherClick"
                    :style="{ width: '100%' }"
                  >
                    <template slot="append">
                      <el-button type="primary" @click="teacherClick"
                        >选择班主任</el-button
                      ></template
                    >
                  </el-input>
                </el-form-item>
              </el-col>

              <!-- <el-col :span="12">
              <el-form-item
                label="评价管理内容"
                prop="pjManage"
                label-width="120px"
              >
                <el-input
                  v-model="dataForm.pjManage"
                  placeholder="请输入"
                  clearable
                  readonly
                  :style="{ width: '100%' }"
                >
                </el-input>
              </el-form-item>
            </el-col> -->

              <el-col :span="12">
                <el-form-item label="联系方式" prop="phone" label-width="120px">
                  <el-input
                    v-model="dataForm.phone"
                    placeholder="选择班主任后自动带入"
                    clearable
                    readonly
                    :style="{ width: '100%' }"
                  >
                  </el-input>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item
                  label="培训方式"
                  prop="train_mode"
                  label-width="120px"
                >
                  <el-select
                    v-model="dataForm.train_mode"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    @change="changeType"
                    :multiple="false"
                  >
                    <el-option
                      v-for="(item, index) in getDict('bjpxfs')"
                      :key="index"
                      :label="item.dataName"
                      :value="item.id"
                      :disabled="item.disabled"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item
                  label="报名开始时间"
                  prop="signupdate_start"
                  label-width="120px"
                >
                  <el-date-picker
                    v-model="dataForm.signupdate_start"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    value-format="timestamp"
                    type="date"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item
                  label="报名结束时间"
                  prop="signupdate_end"
                  label-width="120px"
                >
                  <el-date-picker
                    v-model="dataForm.signupdate_end"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    value-format="timestamp"
                    type="date"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item
                  label="培训开始时间"
                  prop="traindate_start"
                  label-width="120px"
                >
                  <el-date-picker
                    v-model="dataForm.traindate_start"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    value-format="timestamp"
                    type="datetime"
                    default-time="00:00:00"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item
                  label="培训结束时间"
                  prop="traindate_end"
                  label-width="120px"
                >
                  <el-date-picker
                    v-model="dataForm.traindate_end"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    value-format="timestamp"
                    type="datetime"
                    default-time="00:00:00"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <!-- 
            <el-col :span="12">
              <el-form-item
                label="培训时长"
                prop="train_duration"
                label-width="120px"
              >
                <el-input
                  v-model="dataForm.train_duration"
                  placeholder="数字文本"
                >
                </el-input>
              </el-form-item>
            </el-col> -->

              <el-col :span="12">
                <el-form-item
                  v-if="
                    getDict('bjpxfs', dataForm.train_mode) !== '线上线下相结合'
                  "
                  label="学时"
                  prop="hours"
                  label-width="120px"
                >
                  <!-- <el-input
                  v-model="dataForm.hours"
                  placeholder="数字文本"
                  onkeyup="this.value=this.value.replace(/\D/g,'')"
                  onafterpaste="this.value=this.value.replace(/\D/g,'')"
                >
                </el-input> -->
                  <el-input-number
                    step-strictly
                    v-model="dataForm.hours"
                    :step="1"
                    :min="1"
                  ></el-input-number>
                </el-form-item>
                <div
                  class="xsxx"
                  style="display: flex"
                  v-if="
                    getDict('bjpxfs', dataForm.train_mode) == '线上线下相结合'
                  "
                >
                  <el-form-item
                    label="线上学时"
                    prop="onlinetime"
                    label-width="120px"
                  >
                    <!-- <el-input
                    v-model="dataForm.onlinetime"
                    onkeyup="this.value=this.value.replace(/\D/g,'')"
                    onafterpaste="this.value=this.value.replace(/\D/g,'')"
                    placeholder="数字文本"
                  >
                  </el-input> -->
                    <el-input-number
                      step-strictly
                      v-model="dataForm.onlinetime"
                      :step="1"
                      :min="1"
                    ></el-input-number>
                  </el-form-item>
                  <el-form-item
                    label="线下学时"
                    prop="underlinetime"
                    label-width="120px"
                  >
                    <!-- <el-input
                    v-model="dataForm.underlinetime"
                    onkeyup="this.value=this.value.replace(/\D/g,'')"
                    onafterpaste="this.value=this.value.replace(/\D/g,'')"
                    placeholder="数字文本"
                  >
                  </el-input> -->
                    <el-input-number
                      step-strictly
                      v-model="dataForm.underlinetime"
                      :step="1"
                      :min="1"
                    ></el-input-number>
                  </el-form-item>
                </div>
              </el-col>
              <!-- <el-col :span="12">
              <el-form-item label="难度" prop="difficulty" label-width="120px">
                <el-select
                  v-model="dataForm.difficulty"
                  placeholder="请选择"
                  clearable
                  :style="{ width: '100%' }"
                  :multiple="false"
                >
                  <el-option
                    v-for="(item, index) in getDict('difficulty')"
                    :key="index"
                    :label="item.dataName"
                    :value="item.id"
                    :disabled="item.disabled"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col> -->

              <el-col :span="12">
                <el-form-item
                  label="费用(元)"
                  prop="traincharge"
                  label-width="120px"
                >
                  <!-- <el-input
                  v-model="dataForm.traincharge"
                  placeholder="数字文本"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^\./g, '').replace(/^(\-)*(\d+)\.(\d{2}).*$/, '$1$2.$3')"
                >
                </el-input> -->
                  <el-input-number
                    v-model="dataForm.traincharge"
                    :precision="2"
                    :step="1"
                    :min="0"
                  ></el-input-number>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  label="封面"
                  prop="class_cover"
                  label-width="120px"
                >
                  <JADP-UploadImg
                    v-model="class_coverList"
                    :fileSize="2"
                    sizeUnit="MB"
                    :limit="1"
                  >
                  </JADP-UploadImg>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  label="报名登记表附件"
                  prop="files"
                  label-width="120px"
                >
                  <JADP-UploadFz
                    v-model="filesList"
                    :fileSize="200"
                    sizeUnit="MB"
                    :limit="9"
                  >
                  </JADP-UploadFz>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  label="班级简介"
                  prop="train_address"
                  label-width="120px"
                >
                  <el-input
                    v-model="dataForm.train_address"
                    placeholder="请输入"
                    :style="{ width: '100%' }"
                    type="textarea"
                    :autosize="{ minRows: 4, maxRows: 4 }"
                  >
                  </el-input>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item
                  label="班级须知"
                  prop="clazznotice"
                  label-width="120px"
                >
                  <el-input
                    v-model="dataForm.clazznotice"
                    placeholder="请输入"
                    :style="{ width: '100%' }"
                    type="textarea"
                    :autosize="{ minRows: 4, maxRows: 4 }"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <!-- <el-col :span="24">
              <el-form-item label="教师告知" prop="motto" label-width="120px">
                <JADP-Quill
                  v-model="dataForm.motto"
                  placeholder="请输入内容..."
                >
                </JADP-Quill>
              </el-form-item>
            </el-col> -->
              <div v-show="false">
                <el-col :span="12">
                  <el-form-item
                    label="创建用户"
                    prop="creatoruserid"
                    label-width="120px"
                  >
                    <el-input
                      v-model="dataForm.creatoruserid"
                      placeholder="系统自动生成"
                      readonly
                    >
                    </el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="12">
                  <el-form-item
                    label="创建时间"
                    prop="creatortime"
                    label-width="120px"
                  >
                    <el-input
                      v-model="dataForm.creatortime"
                      placeholder="系统自动生成"
                      readonly
                    >
                    </el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="12">
                  <el-form-item
                    label="修改用户"
                    prop="lastmodifyuserid"
                    label-width="120px"
                  >
                    <el-input
                      v-model="dataForm.lastmodifyuserid"
                      placeholder="系统自动生成"
                      readonly
                    >
                    </el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="12">
                  <el-form-item
                    label="修改时间"
                    prop="lastmodifytime"
                    label-width="120px"
                  >
                    <el-input
                      v-model="dataForm.lastmodifytime"
                      placeholder="系统自动生成"
                      readonly
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
              </div>
            </el-tab-pane>
            <el-tab-pane label="课程规则" name="second">
              <el-row>
                <el-col :span="12">
                  <el-form-item label="是否开启摄像头抓拍" prop="crmcamera">
                    <el-radio-group v-model="dataForm.crmcamera" size="small">
                      <el-radio label="1">是</el-radio>
                      <el-radio label="0">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>

                <el-col :span="12" v-if="dataForm.crmcamera == 1">
                  <el-form-item label="摄像头抓拍间隔时间" prop="crmcameratime">
                    <el-input-number
                      v-model="dataForm.crmcameratime"
                      @blur="
                        inputNumber(dataForm.crmcameratime, 'crmcameratime')
                      "
                      :min="1"
                      :step="1"
                      step-strictly
                    ></el-input-number>
                    <span style="margin-left:10px;color:#606266">分钟</span>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12">
                  <el-form-item label="防挂机校验" prop="crmface">
                    <el-select
                      v-model="dataForm.crmface"
                      placeholder="请选择"
                      clearable
                    >
                      <el-option label="人脸识别" value="1"></el-option>
                      <el-option label="验证码" value="2"> </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>

                <el-col :span="12" v-if="dataForm.crmface">
                  <el-form-item
                    :label="
                      dataForm.crmface == 1
                        ? '人脸认证间隔时间'
                        : '验证码间隔时间'
                    "
                    prop="crmfacetime"
                  >
                    <el-input-number
                      v-model="dataForm.crmfacetime"
                      @blur="inputNumber(dataForm.crmfacetime, 'crmfacetime')"
                      :min="1"
                      :step="1"
                      step-strictly
                    ></el-input-number>
                    <span style="margin-left:10px;color:#606266">分钟</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-tab-pane>
          </el-tabs>
        </el-form>
      </el-row>
      <Headmaster ref="teacherList" @determine="determineTeacherList" />
      <EvaluationTable
        v-if="evaluationVisible"
        ref="EvaluationTable"
        @determine="determineCoursewareTable"
      />
    </div>
  </transition>
  <!-- <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button
        type="primary"
        @click="dataFormSubmit()"
        v-if="!isDetail"
        :loading="btnLoading"
        >确 定</el-button
      >
    </span> -->
  <!-- <Headmaster ref="teacherList" @determine="determineTeacherList" />
  <EvaluationTable
    v-if="evaluationVisible"
    ref="EvaluationTable"
    @determine="determineCoursewareTable"
  /> -->
  <!-- </el-dialog> -->
</template>
<script>
import request from "@/utils/request";
import ExportBox from "./ExportBox";
import KeChengPeiXun from "./kechengpeixun.vue";
import TeacherList from "../xy_ks_courseware/teachertable.vue";
import Headmaster from "./headmaster.vue";
import EvaluationTable from "./pingjia/evaluationTable.vue";
export default {
  name: "bbb",
  components: { ExportBox, KeChengPeiXun, Headmaster, EvaluationTable },
  props: {
    premium: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    // var validateTraincharge = (rule, value, callback) => {
    //   if (value == 0) {
    //     callback(new Error("金额不能为0"));
    //   } else {
    //     callback();
    //   }
    // };
    return {
      loading: true,
      listLoading: true,
      btnLoading: false,
      visible: false,
      isDetail: false,
      teacherList: [],
      activeName: "first",
      evaluationVisible: false,
      dataForm: {
        clazzno: undefined,
        classname: undefined,
        categorytype: "",
        train_type: "",
        area: "",
        pjmanagename: "",
        signupdate_start: undefined,
        signupdate_end: "",
        traindate_start: "",
        traindate_end: "",
        onlinetime: "",
        underlinetime: "",
        train_mode: "",
        train_duration: undefined,
        traincharge: undefined,
        class_cover: [],
        train_address: undefined,
        creatoruserid: "",
        creatortime: "",
        lastmodifyuserid: "",
        lastmodifytime: "",
        isNewtest: "",
        isHottest: "",
        hours: "",
        trainway: "",
        difficulty: "",
        clazznotice: "",
        motto: "",
        headteacher: "",
        wheEvaluate: "",
        wheExamine: "",
        phone: "",
        files: [],
        crmcreditacquisition: "",
        crmcameratime: "",
        crmvercodetime: "",
        crmfacetime: "",
        crmface: "",
        crmcamera: "0",
        crmvercode: "0",
        pjManage: "",
        pjManageName: "",
        organizeId:"",
      },
      rules: {
        clazzno: [
          {
            required: true,
            message: "请输入",
            trigger: "blur"
          }
        ],
        headteacher: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        wheEvaluate: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        wheExamine: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        phone: [
          {
            required: true,
            message: "请输入",
            trigger: "change"
          }
        ],
        classname: [
          {
            required: true,
            message: "请输入",
            trigger: "blur"
          }
        ],
        categorytype: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        train_type: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        signupdate_start: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        signupdate_end: [
          {
            required: true,
            message: "请至少选择一个",
            trigger: "change"
          }
        ],
        traindate_start: [
          {
            required: true,
            message: "请至少选择一个",
            trigger: "change"
          }
        ],
        traindate_end: [
          {
            required: true,
            message: "请至少选择一个",
            trigger: "change"
          }
        ],
        // trainway: [
        //   {
        //     required: true,
        //     message: "请至少选择一个",
        //     trigger: "change"
        //   }
        // ],
        train_mode: [
          {
            required: true,
            message: "请选择",
            trigger: "change"
          }
        ],
        // train_duration: [
        //   {
        //     required: true,
        //     message: "数字文本",
        //     trigger: ["blur", "change"]
        //   }
        // ],
        traincharge: [
          // { validator: validateTraincharge, trigger: "blur" },

          {
            required: true,
            message: "请输入费用大于或等于0",
            trigger: ["blur", "change"]
          }
        ],
        hours: [
          {
            required: true,
            message: "数字文本",
            trigger: ["blur", "change"]
          }
        ],
        onlinetime: [
          {
            required: true,
            message: "数字文本",
            trigger: ["blur", "change"]
          }
        ],
        underlinetime: [
          {
            required: true,
            message: "数字文本",
            trigger: ["blur", "change"]
          }
        ],
        class_cover: [
          {
            required: true,
            message: "请至少选择一个",
            trigger: "click"
          }
        ]
      },
      class_coverList: [],
      class_cover: [],
      filesList: [],
      selectValue: "",
      evaluateArr: []
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getteacherList();
  },
  mounted() {},
  methods: {
    goBack() {
      this.$emit("refresh", true);
    },
    inputNumber(item, key) {
      if (!item) {
        this.dataForm[key] = 1;
      }
    },
    //教师table
    teacherClick() {
      this.$refs.teacherList.teacherVisible = true;
    },
    determineTeacherList(val) {
      this.dataForm.headteacher = val.name;
      this.dataForm.phone = val.tel;
    },
    //获取讲师list
    getteacherList() {
      request({
        url: `/api/teachersManage/Xy_ks_teachers/getAllList?organizeId=${this.$store.getters.organizeId}`,
        method: "post"
      }).then(res => {
        this.teacherList = res.data;
      });
    },
    init(id, isDetail) {
      this.class_coverList = [];
      this.dataForm.id = id || 0;
      this.visible = true;
      this.isDetail = isDetail || false;
      this.$nextTick(() => {
        this.$refs["elForm"].resetFields();
        if (this.dataForm.id) {
          this.loading = true;
          request({
            url: `/api/xy_ks_class_info/Xy_ks_class_info/${this.dataForm.id}`,
            method: "get"
          }).then(res => {
            this.dataForm = res.data;
            this.class_coverList = this.dataForm.class_cover
              ? JSON.parse(this.dataForm.class_cover)
              : [];
            this.filesList = this.dataForm.files
              ? JSON.parse(this.dataForm.files)
              : [];
            if (this.dataForm.crmface == 1) {
              this.selectValue = 1;
            } else if (this.dataForm.crmvercode == 1) {
              this.selectValue = 2;
            } else {
              this.selectValue = "";
            }
            this.loading = false;
          });
        }
      });
    },
    keyupCheck(item) {
      item = item.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
      item = item.replace(/^\./g, ""); //验证第⼀个字符是数字⽽不是.
      item = item.replace(/\.{2,}/g, "."); //只保留第⼀个. 清除多余的
      item = item
        .replace(".", "$#$")
        .replace(/\./g, "")
        .replace("$#$", ".");
      item = item.replace(/^(\-)*(\d+)\.(\d{2}).*$/, "$1$2.$3"); //只能输⼊1个⼩数
    },
    changeType(val) {
      if (val == "611addcd33f046e1acdd8ead67539bd4") {
        this.dataForm.hours = 0;
      }else {
        this.dataForm.onlinetime = 0;
        this.dataForm.underlinetime = 0;
      }
    },
    onClose() {
      this.$emit("refresh", true);
    },
    // 表单提交
    dataFormSubmit() {
      this.dataForm.organizeId = this.$store.getters.organizeId;
      this.$set(
        this.dataForm,
        "class_cover",
        this.class_coverList.length ? JSON.stringify(this.class_coverList) : ""
      );
      this.$set(
        this.dataForm,
        "files",
        this.filesList.length ? JSON.stringify(this.filesList) : ""
      );
      this.$refs["elForm"].validate(valid => {
        if (valid) {
          this.dataForm.organizeId= this.$store.getters.organizeId;

          if (!this.dataForm.id) {
            this.dataForm.premium = this.premium;
            this.btnLoading = true;
            request({
              url: `/api/xy_ks_class_info/Xy_ks_class_info`,
              method: "post",
              data: this.dataForm
            })
              .then(res => {
                this.$message({
                  message: res.msg,
                  type: "success",
                  duration: 1000
                });
                this.visible = false;
                this.$emit("refresh", true);
                this.btnLoading = false;
              })
              .catch(err => {
                this.btnLoading = false;
              });
          } else {
            this.btnLoading = true;
            request({
              url: "/api/xy_ks_class_info/Xy_ks_class_info/" + this.dataForm.id,
              method: "PUT",
              data: this.dataForm
            })
              .then(res => {
                this.$message({
                  message: res.msg,
                  type: "success",
                  duration: 1000
                });
                this.visible = false;
                this.$emit("refresh", true);
                this.btnLoading = false;
              })
              .catch(err => {
                this.btnLoading = false;
              });
          }
        }
      });
    },
    //获取评价
    acquisitionEvaluation() {
      this.evaluationVisible = true;
      this.$nextTick(() => {
        this.$refs.EvaluationTable.evaluateArr = this.dataForm.pjManage;
        this.$refs.EvaluationTable.initData();
      });
    },
    determineCoursewareTable(val) {
      console.log(val, "data111111111111111111111111");
      this.dataForm.pjManage = val.map(item => item.id).join();
      this.dataForm.pjManageName = val.map(item => item.content).join();
      console.log(this.dataForm.pjManage, "this.dataForm.pjManage");
    }
  }
};
</script>

<!-- <style lang="scss" scoped> -->
// ::v-deep .hx {
//   // margin-left: 20px;
//   width: 535px !important;
// }
// ::v-deep .hx_ {
//   // margin-left: 20px;
//   width: 1205px !important;
// }
// .xsxx ::v-deep .el-input__inner {
//   width: 100%;
// }
// ::v-deep .el-dialog__body {
//   min-height: 670px;
// }
.main {
  padding: 10px;
  >>> .el-tabs__header {
    padding-left: 20px;
  }
}
.teacher {
  ::v-deep .el-input__inner {
    cursor: pointer;
  }
}
</style>
